<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="com.esurvey.core.*" %>
<%@ page import="java.util.ArrayList" %>
<HTML>
<HEAD>
	<TITLE>eSurvey - Creaci&oacute;n de nueva encuesta</TITLE>
	<LINK href="styles/general.css" type="text/css" rel="stylesheet">
	<LINK href="styles/addSurvey.css" type="text/css" rel="stylesheet">
	<LINK href="styles/jquery-ui-1.7.2.custom.css" type="text/css" rel="stylesheet">
	<SCRIPT src="jquery/jquery.js" type="text/javascript"></SCRIPT>
	<SCRIPT src="js/global.js" type="text/javascript"></SCRIPT>
	<SCRIPT src="jquery/ui.datepicker.js" type="text/javascript"></SCRIPT>
	<SCRIPT src="jquery/jquery.filestyle.js" type="text/javascript"></SCRIPT>
	<SCRIPT src="js/createSurvey.js" type="text/javascript"></SCRIPT>
</HEAD>
<BODY>
<%
	if ((session.getAttribute("kind") == "user") || (session.getAttribute("kind") == "admin")) {
%>
	<DIV id="general">
		<DIV id="header">
			<%@ include file="header.jsp" %>
		</DIV>
		<DIV id="content" height="233">
				<DIV id="main">
					<DIV id="headerTitle">
						<DIV id="title">
							<H1>Creaci&oacute;n de encuesta en vista dise&ntilde;o:</H1>
						</DIV>
						<DIV id="imageCreateSurvey">
							<IMG SRC="images/insertSurvey.png" class="insertSurvey" title="Crear encuesta" onclick="checkSurvey()"></IMG>
						</DIV>
					</DIV>
					<DIV id="warning"></DIV>
					<FORM id="surveyForm" action="createSurvey.jsp" method="POST">
						<DIV id="surveyHeader">
							<DIV class="filasHeader">
								<LABEL for="subject">
									Asunto: <SPAN class="req">*</SPAN>
								</LABEL>
								<INPUT id="subject" name="subject" type="text" class="textfieldLarge" tabindex="1">
								<LABEL for="dueDate" class="dueDate">
									Fecha de vencimiento: <SPAN class="req">*</SPAN>
								</LABEL>
								<INPUT id="dueDate" name="dueDate" type="text" class="textfield" tabindex="2" readonly="readonly">
							</DIV>
							<DIV class="filasHeader">
								<LABEL for="subject">
									Tipo de encuesta: <SPAN class="req">*</SPAN>
								</LABEL>
								<input type="radio" id="kind" name="kind" class="surveyKind" value="0" tabindex="3" onclick="hideChooser()" checked="checked">P&uacute;blica
								<input type="radio" id="kind" name="kind" class="surveyKind" value="1" tabindex="4" onclick="displayChooser()">Privada
								<LABEL for="category" class="category">
									Categor&iacute;a: <SPAN class="req">*</SPAN>
								</LABEL>
								<SELECT id="category" name="category" class="select" tabindex="5">
									<%
										ArrayList<Category> categories = eSurveyPersistence.loadCategories();
										for (Category c: categories) {
											out.println("<OPTION>" + c.getName() + "</OPTION>");
										}
									%>
								</SELECT>
								<LABEL for="anonymous" class="anonymous">
									An&oacute;nima:<SPAN class="req">*</SPAN>
								</LABEL>
								<INPUT id="anonymous" name="anonymous"  type="checkbox" class="checkbox" tabindex="6" onclick="showState()">
								<LABEL id="anonymousSelec" name="anonymousSelec" class="anonymousSelec">No</LABEL>
							</DIV>
							<DIV id="components" class="components">
								<H2>Componentes:</H2>
								<DIV id="1" name="surveyQuestion" class="surveyQuestion">
									<FIELDSET name="groupingQuestions" class="groupingQuestions">
										<DIV class="question">
											<LABEL>Pregunta:</LABEL>
											<INPUT type="text" name="question1" class="surveyTextfieldLarge">
										</DIV>
										<DIV name="answers1" class="answers">
											<LABEL class="answerKind">Tipo respuesta:</LABEL>
											<SELECT name="kindAnswerSelector1" class="select answerSelector" onchange="kindAnswerSelected()">
												<OPTION>Respuesta abierta</OPTION>
												<OPTION>Monorespuesta</OPTION>
												<OPTION>Multirespuesta</OPTION>
											</SELECT>

											<IMG id="addAnswer1" class="addAnswer" name="addAnswer1" src="images/add.gif" title="A&ntilde;adir respuesta" onclick="addNewAnswer()"/>
											<IMG id="delAnswer1" class="delAnswer" name="delAnswer1" src="images/delete.png" title="Eliminar respuesta" onclick="deleteAnwer()"/>
											<INPUT type="text" name="answer1" class="answer">
											<IMG id="delAllAnswers1" class="delAllAnswers" name="delAllAnswers1" src="images/delAllAnswers.png" title="Eliminar todas las respuestas en blanco" onclick="deleteEmptyAnwers()"/>
										</DIV>
									</FIELDSET>
									<IMG id="addQuestion" name="addQuestion" class="addQuestion" src="images/add.gif" title="A&ntilde;adir pregunta" onclick="addNewQuestion()"/>
									<IMG id="delQuestion" name="delQuestion" class="delQuestion" src="images/delete.png" title="Eliminar pregunta" onclick="deleteQuestion()"/>
								</FORM>
								</DIV>
					</DIV>
					<DIV id="nav">
						<% if (session.getAttribute("kind") == "user") { %>
							<%@ include file="pollsterTabs.html" %>
						<% } else if (session.getAttribute("kind") == "admin") { %>
							<%@ include file="adminTabs.html" %>
						<% } %>
					</DIV>
				</FORM>
			</DIV>
		<DIV id="footer">
			<%@ include file="footer.jsp" %>
		</DIV>
		
	</DIV>
<%
	} else {
			response.sendRedirect("login.jsp");
	}
%>
</BODY>
</HTML>
